<template>
	<view>
		<image class="loading-img" mode="aspectFit" v-show="loading" src="https://7463-tcb-zoumbaexjdidjmj2ff212-5d3479-1303238310.tcb.qcloud.la/static/easy-loadimage/loading.gif"></image>
		<image v-show="!loading" class="splash-img" src="https://test.the3dspace.cn/api-file/download?fileName=mall/files/splash.jpg" mode="aspectFill" @error="handleError" @load="handleLoad"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loading: true
			}
		},
		onReady() {
			
		},
		methods: {
			handleError(err) {
				this.$log("加载启动画面遇到错误", err);
				uni.switchTab({
					url: "../platform/goods-list"
				})
				this.loading = false;
			},
			handleLoad() {
				this.loading = false;
				this.startTimer();
			},
			startTimer() {
				setTimeout(()=>{
					uni.switchTab({
						url: "../platform/goods-list"
					})
				}, 3000);
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}
	.splash-img {
		position: absolute;
		width: 100vw;
		height: 100vh;
	}
	.loading-img {
		position: absolute;
		top: var(--status-bar-height);
		width: 60rpx;
		height: 60rpx;
	}
</style>
